import { createRouter, createWebHistory } from 'vue-router'


const router = createRouter({
  history: createWebHistory(),
  routes: [
    {
      path:'/home',
      component: () => import('@/views/home/index.vue'),
      meta:{
          title:'首页',
          show: true
      },
    },
    {
      path:'/login',
      component: () => import('@/views/login/index.vue'),
      meta:{
        title:'登录',
        show: false
      }
    },
    {
      path:'/register',
      component: () => import('@/views/register/index.vue'),
      meta:{
        title:'注册',
        show:false
      }
    },
    {
      path:'/person',
      component: () => import('@/views/person/index.vue'),
      meta:{
        title:'个人中心',
        show: true
      }
    },
    {
      path:'/news',
      component: () => import('@/views/policyAndmessage/index.vue'),
      meta:{
        title:'助农资讯/政策',
        show: true
      }
    },
    {
      path:'/newsDetail',
      component: () => import('@/views/policyAndmessage/detail/index.vue'),
      meta:{
        title:'助农资讯/政策详情页',
        show: true
      }
    },
    {
      path:'/detail/:id',
      component: () => import('@/views/detail/index.vue'),
      meta:{
        title:'商品详情',
        show: true
      }
    },
    {
      path:'/goodsList',
      component: () => import('@/views/goodsList/index.vue'),
      meta:{
        title:'农产品',
        show: true
      }
    },
    {
      path:'/list',
      component: () => import('@/views/list/index.vue'),
      meta:{
        title:'特色农产品',
        show: true
      }
    },
    {
      path:'/pay',
      component: () => import('@/views/pay/index.vue'),
      meta:{
        title:'支付',
        show: true
      }
    },
    {
      path:'/paySuccess',
      component: () => import('@/views/paySuccess/index.vue'),
      meta:{
        title:'支付成功',
        show: true
      }
    },
    {
      path:'/shopCart',
      component: () => import('@/views/shopCart/index.vue'),
      meta:{
        title:'购物车',
        show: true
      }
    },
    {
      path:'/submit-order',
      component: () => import('@/views/submitOrder/index.vue'),
      meta:{
        title:'订单提交',
        show: true
      }
    },
    {
      path:'/order',
      component: () => import('@/views/order/index.vue'),
      meta:{
        title:'我的订单',
        show: true
      }
    },
    {
      path:'/address',
      component: () => import('@/views/address/index.vue'),
      meta:{
        title:'我的地址',
        show: true
      }
    },
    // 重定向
    {
      path: "/",
      redirect: "/home",
    },
  ],
  // 滚动行为
  scrollBehavior(){
    return{
        left:0,
        top:0
    }
  }
})

export default router
